﻿@{ ViewBag.Title = "Index";
    Layout = "~/Areas/Shared/_LayuiList.cshtml"; }

<form class="layui-form">
    <input style="display: none" id="listid" value="@ViewBag.listid">
    <input style="display: none" id="fwid" value="@ViewBag.fwid">
    <div class="layui-tab" lay-filter="tabDemo">
        <ul class="layui-tab-title">
            <li class="layui-this" lay-id="1">流程记录</li>
            <li lay-id="2">操作记录</li>
        </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
                <table class="layui-hide" id="tableId" lay-filter="tableFilter"></table>
            </div>
            <div class="layui-tab-item">
                <table class="layui-hide" id="tableId02" lay-filter="tableFilter"></table>
            </div>
        </div>
    </div>
</form>

<!--数据表格-->


<script src="~/lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
<script src="~/js/lay-config.js?v=2.0.0" charset="utf-8"></script>
<script>
    layui.use(["table", "element", "form", "exLayer", "exUtils", "miniPage"], function () {
        let table = layui.table;
        let form = layui.form;
        let exLayer = layui.exLayer;
        let exUtils = layui.exUtils;
        let miniPage = layui.miniPage;
        let element = layui.element;

        let $ = layui.$;
        element.on('tab(tabDemo)', function (data) {

        });

        form.render(); //初始化表单，要加上，不然刷新部分组件可能会不加载

        let ThisTable = table.render({
            elem: "#tableId",
            url: "/SysFlow/FlowRunList/GetFlowRunPrcsList?listid=" + $("#listid").val() + "&fwid=" + $("#fwid").val(),
            defaultToolbar: ['filter', 'exports'],
            cols: [[
                { field: "FlowPrcs", title: "名称", width: 100 },
                { title: "状态", templet: "#RunFlag", width: 80, sort: true },
                { title: "接手", width: 150, templet: "#Begin_Tp" },
                { title: "转交", width: 150, templet: "#Deliver_Tp" },
                { field: "StepInfo",  title: "转交步骤" },
                { field: "DeliverComments", title: "转交意见" }
            ]],
            done: function (res, curr, count) {
                console.log(res, curr, count);
            }
        });

        let ThisTable02 = table.render({
            elem: "#tableId02",
            url: "/SysFlow/FlowRunList/GetFlowRunRecord?listid=" + $("#listid").val() + "&fwid=" + $("#fwid").val(),
            defaultToolbar: ['filter', 'exports'],
            cols: [[
                { field: "OperatePerson", title: "用户", width: 100, sort: true },
                { field: "OperateTime", title: "时间", width: 200, sort: true },
                { field: "Info", title: "操作", sort: true }
            ]],
            done: function (res, curr, count) {
                console.log(res, curr, count);
            }
        });
    });
</script>
<script type='text/html' id='Begin_Tp'>
    {{#  if(d.BeginUserId != null){ }}
    <span>{{d.BeginUserId}} {{d.BeginTime}}</span>
    {{#  }else{ }}
    {{#  } }}
</script>
<script type='text/html' id='Deliver_Tp'>
    {{#  if(d.DeliverUserId != null){ }}
    <span>{{d.DeliverUserId}} {{d.DeliverTime}}</span>
    {{#  }else{ }}
    {{#  } }}

</script>
<script type='text/html' id='RunFlag'>
    {{#  if(d.RunFlag == '1'){ }}
    <span>待接收</span>
    {{#  } }}
    {{#  if(d.RunFlag == '2'){ }}
    <span>办理中</span>
    {{#  } }}
    {{#  if(d.RunFlag == '3'){ }}
    <span>已结束</span>
    {{#  } }}
</script>
<script type='text/html' id='StepInfo'>
    {{#d.StepInfo}}
</script>
<script type="text/html" id="toolbarTpl">
    <button class="layui-btn layui-btn  layui-btn-sm" lay-event="add" id="add"><i class="fa fa-plus"></i>添加分类</button>
</script>
<!-- 行工具栏模板 -->
<script type="text/html" id="operationTpl">
    <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit" id="edit">编辑</a>
    <a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del" id="del">删除</a>
</script>